package cn.edu.ujn.service;

import cn.edu.ujn.dao.ParkingGuidanceCarParkInfo;
import cn.edu.ujn.dao.ParkingGuidanceInfo;
import cn.edu.ujn.dao.ParkingGuidanceInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ParkingGuidanceInfoServiceImpl implements IParkingGuidanceInfoService{

    @Autowired
    private ParkingGuidanceInfoMapper parkingGuidanceInfoDao;
    @Override
    public int insertParkingGuidance(ParkingGuidanceInfo parkingGuidanceInfo) {
        return parkingGuidanceInfoDao.insertParkingGuidance(parkingGuidanceInfo);
    }

    @Override
    public int updateParkingGuidance(ParkingGuidanceInfo parkingGuidanceInfo) {
        return parkingGuidanceInfoDao.updateParkingGuidance(parkingGuidanceInfo);
    }

    @Override
    public int deleteParkingGuidance(int guidanceID) {
        return parkingGuidanceInfoDao.deleteParkingGuidance(guidanceID);
    }

    @Override
    public List<ParkingGuidanceInfo> getAllParkingGuidances() {
        return parkingGuidanceInfoDao.selectAllParkingGuidances();
    }

    @Override
    public ParkingGuidanceInfo getParkingGuidanceById(int guidanceID) {
        return parkingGuidanceInfoDao.selectParkingGuidanceById(guidanceID);
    }

    @Override
    public List<ParkingGuidanceCarParkInfo> getCarParksByKeyword(String keyword) {
        return parkingGuidanceInfoDao.selectCarParksByKeyword(keyword);
    }

    @Override
    public int getTotalParkingLots() {
        return parkingGuidanceInfoDao.getTotalParkingLots();
    }

    @Override
    public double getParkingSpaceUsageRate() {
        return parkingGuidanceInfoDao.getParkingSpaceUsageRate();
    }

    @Override
    public int getTimelyAvailableSpaces() {
        return parkingGuidanceInfoDao.getTimelyAvailableSpaces();
    }
}
